#ifndef GUI_H
#define GUI_H



#include "../AI_Tester/includes.h"
#include "widget_main.h"
#include "widget_setup.h"
#include "widget_listener.h"
#include "server_listener.h"



class main_widget;
class setup_widget;
class listener_widget;



/** @brief Main gui window
*
*   \image html gui.jpeg
*/
class gui: public QMainWindow
{

	Q_OBJECT

public:

	/**	@brief Constructor creates the window, sets main_widget as the central widget
	*	@param parent Qt parent of the widget
	*	@param flags Qt flags
	*/
	gui( QWidget *parent = 0, Qt::WFlags flags = 0 );


	//! pointer to main_widget
	main_widget* main_w;
	//! pointer to setup_widget
	setup_widget* setup_w;
	//! pointer to listener_widget
	listener_widget* listener_w;

};



/** @brief Class for controlling the whole gui
*
*   \image html gui.jpeg
*/
class server_gui
{

public:
	
	/**	@brief	Function for obaining the singleton
	*	@return	pointer to the singleton
	*/
	static server_gui* get_instance();

	//! @brief Deletes gui
	void rebuild()
	{
	//	if ( g != 0 )
	//		delete g;
	//	g = 0;
	};


	//! @brief Creates gui class
	void create_gui();

	/** @brief Shows network errors when occured
	*	@param s network error message
	*/
	void show_network_error( const string& s );

	/** @brief Shows client's status
	*	@param c client's number
	*	@param s network status message
	*/
	void show_client_status( unsigned int c, const string& s );
	/** @brief Shows client's error when occured
	*	@param c client's number
	*	@param e network error message
	*/
	void show_client_error( unsigned int c, const string& e );
	/** @brief Sets client's name and type
	*	@param c client's number
	*	@param n client's name
	*	@param t client's type
	*/
	void set_client_name( unsigned int c, const string& n, const string& t );
	/** @brief Shows listener's status
	*	@param s status message
	*/
	void show_listener_status( const string& s );
	//! @brief Sets all clients labels do default
	void show_listener_restart();

	//! pointer to gui class
	gui* g;


	int x;


private:

	server_gui( int _x ): x( _x )
	{
		g = 0;
	};
	server_gui( const server_gui& );
	server_gui& operator=( const server_gui& x );
	//! @brief Deletes gui
	~server_gui()
	{
	//	if ( g != 0 )
	//		delete g;
	};

};



#endif
